<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      // 异步请求同步调用
      Promise.all([
        // new Promise((resolve, reject) => {
        //   $ajax({
        //     url: "url1",
        //     success: function (data) {
        //       resolve(data);
        //     },
        //   });
        // }),
        // new Promise((resolve, reject) => {
        //   $ajax({
        //     url: "url2",
        //     success: function (data) {
        //       resolve(data);
        //     },
        //   });
        // }),

        new Promise((resolve, reject) => {
          setTimeout(() => {
            resolve("result1");
          }, 2000);
        }),

        new Promise((resolve, reject) => {
          setTimeout(() => {
            resolve("result2");
          }, 1000);
        }),
      ]).then((results) => {
        console.log(results[0]);
        console.log(results[1]);
      });

      const shareObj = {
        name: "zhouzhou",
      };

      Vue.prototype.shareObj = shareObj;

      Vue.component("cpn1", {
        this.shareObj.name
      });

      Vue.component("cpn2", {});

      const app = new Vue({
        el: "#app",
        data() {

        },
      });
    </script>
  </body>
</html>
